var express = require('express');
var router = express.Router();
var ctrlLocations = require('../controllers/locations');
var ctrlReview = require('../controllers/reviews');

//locations
router.get('/locations',ctrlLocations.locationsListByDistance);
router.post('/locations',ctrlLocations.locationsCreate);
router.get('/locations/:locationid',ctrlLocations.locationsReadOne);
router.put('/locations/:locationid',ctrlLocations.locationsUpdateOne);
router.delete('/locations/:locationid',ctrlLocations.locationsDeleteOne);

//reviews
router.post('/locations/:locationid/reviews',ctrlReview.reviewsCreate);
router.get('/locations/:locationid/reviews/:reviewid',ctrlReview.reviewsReadOne);
router.put('/locations/:locationid/reviews/:reviewid',ctrlReview.reviewsUpdateOne);
router.delete('/locations/:locationid/reviews/:reviewid',ctrlReview.reviewsDeleteOne);

module.exports = router;